/*
 * @Description: 
 * @version: 
 * @Author: cy
 * @Date: 2022-04-28 14:25:18
 * @LastEditors: cy
 * @LastEditTime: 2022-04-28 18:09:57
 */
function ListNode(val, next) {
    this.val = (val === undefined ? 0 : val);
    this.next = (next === undefined ? null : next);
}
var p4 = new ListNode(1);
var p3 = new ListNode(2, p4);
var p2 = new ListNode(2, p3);
var p1 = new ListNode(1, p2);
var isPalindrome = function(head) {
    let cur = head,
    stack = [],
    len = 0 ;
    while(cur){
        stack.push(cur)
        cur = cur.next
        len++
    }
    len >>= 1
    while(len){
        if(head.val != stack.pop().val)return false
        head = head.next
        len--
    }
    return true
}
var bl = isPalindrome(p1);
